﻿using System;
using System.ComponentModel.DataAnnotations;
using Xcj.Mes.WholeLine.DataBase.Common;

namespace Xcj.Mes.WholeLine.DataBase.Entity
{
    public class BatchEntity : BaseEntity
    {
        private string _deviceSn = string.Empty;
        [Alias("机台编号"), StringLength(64)]
        public string DeviceSn                              // 机台编号
        {
            get => _deviceSn;
            set
            {
                _deviceSn = value?.Trim();
                RaisePropertyChanged(nameof(DeviceSn));
            }
        }

        // 钉卷 组立 老化 座板 其它
        private string _deviceType = string.Empty;
        [Alias("设备类型"), StringLength(64)]
        public string DeviceType                            // 设备类型
        {
            get => _deviceType;
            set
            {
                _deviceType = value?.Trim();
                RaisePropertyChanged(nameof(DeviceType));
            }
        }

        private string _batchNumber = string.Empty;
        [Alias("批次料号"), StringLength(64)]
        public string BatchNumber                                        // 料号
        {
            get => _batchNumber;
            set
            {
                _batchNumber = value?.Trim();
                RaisePropertyChanged(nameof(BatchNumber));
            }
        }

        private string _batchName = string.Empty;
        [Alias("批次批号"), StringLength(64)]
        public string BatchName                                        // 批次
        {
            get => _batchName;
            set
            {
                _batchName = value?.Trim();
                RaisePropertyChanged(nameof(BatchName));
            }
        }

        private string _batchSerial = string.Empty;
        [Alias("批次系列"), StringLength(64)]
        public string BatchSerial                                        // 系列
        {
            get => _batchSerial;
            set
            {
                _batchSerial = value?.Trim();
                RaisePropertyChanged(nameof(BatchSerial));
            }
        }

        private string _batchSpecification = string.Empty;
        [Alias("批次规格"), StringLength(64)]
        public string BatchSpecification                                // 规格
        {
            get => _batchSpecification;
            set
            {
                _batchSpecification = value?.Trim();
                RaisePropertyChanged(nameof(BatchSpecification));
            }
        }

        private string _batchSize = string.Empty;
        [Alias("批次尺寸"), StringLength(64)]
        public string BatchSize                                         // 尺寸
        {
            get => _batchSize;
            set
            {
                _batchSize = value?.Trim();
                RaisePropertyChanged(nameof(BatchSize));
            }
        }

        private string _schedule = string.Empty;
        [Alias("班次"), StringLength(16)]
        public string Schedule                                          // 班次
        {
            get => _schedule;
            set
            {
                _schedule = value?.Trim();
                RaisePropertyChanged(nameof(Schedule));
            }
        }

        private int _outputCount = 0;
        [Alias("生产总数")]
        public int OutputCount                                          // 生产总数
        {
            get => _outputCount;
            set
            {
                _outputCount = value;
                RaisePropertyChanged(nameof(OutputCount));
            }
        }

        private int _goodCount = 0;
        [Alias("良品总数")]
        public int GoodCount                                             // 良品总数
        {
            get => _goodCount;
            set
            {
                _goodCount = value;
                RaisePropertyChanged(nameof(GoodCount));
            }
        }

        private int _notGoodCount = 0;
        [Alias("不良品数")]
        public int NotGoodCount                                         // 不良品数
        {
            get => _notGoodCount;
            set
            {
                _notGoodCount = value;
                RaisePropertyChanged(nameof(NotGoodCount));
            }
        }

        private double _yield = 0;
        [Alias("良品率")]
        public double Yield                                              // 良品率
        {
            get => _yield;
            set
            {
                _yield = Math.Round(value,2);
                RaisePropertyChanged(nameof(Yield));
            }
        }
    }
}
